#include "App_Run.h"

void App_Run_Init(void)
{
    Int_MT6816_Init();
    App_PWR_LowPowerInit();
    Int_SP3485_Init();
    Int_SN65HVD_Init();
}

void App_Run_Start(void)
{
    static uint16_t station_times = 0;
    char temp_str[50];
    Int_MT6816_AllInfo(0);
    sprintf(temp_str, "length: %.2f\ncount: %d\n", Magnetic_Info.length,__HAL_TIM_GET_COUNTER(&htim3));

    Int_SP3485_SendString(temp_str, HAL_MAX_DELAY);
    Int_24C256_WriteFloat(0x0001, Magnetic_Info.length);
    if (Magnetic_Info.direction == 0)
    {
        station_times++;
        if (station_times >= 10)
        {
            station_times = 0;
            App_PWR_Enter_LowPower();
        }
        Int_SP3485_SendString("station...\n", HAL_MAX_DELAY);
    }
    else
    {
        station_times = 0;
    }
    HAL_Delay(1000);
}
